package com.mef.smsplat.web.controller;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.mef.smsplat.service.AirportInfoService;
import com.mef.smsplat.service.CacheService;
import com.mef.smsplat.service.TempVarInfoService;
import com.mef.smsplat.web.controller.base.Json;

/**
 * 系统配置管理：<br/>
 * 1、Eterm流量统计查看<br/>
 * 2、系统缓存管理，主要是清理刷新，查看统计信息等
 * 
 * @author hc24
 * 
 */
@Controller
@RequestMapping("/sys/sysconfig/")
public class SysConfigController {
	private CacheService cacheService;

	public void setCacheService(CacheService cacheService) {
		this.cacheService = cacheService;
	}
	
	/**
	 * 刷新缓存
	 * @return
	 */
	@ResponseBody
	@RequestMapping("refreshCache.sys")
	public Json refreshCache() {
		System.out.println("==============刷新机场和模版变量信息=============");
		cacheService.initCache();//从新刷新缓存
		return new Json();
	}
	
	/**
	 * 缓存统计
	 * @return
	 */
	@RequestMapping("statCache.sys")
	public ModelAndView statCache(){
		ModelAndView av=new ModelAndView("page/sys/cache/cache");
		av.addObject("list", cacheService.statCache());
		return av;
	}
	
	/**
	 * 统计Eterm配置发送指令数量
	 * @return
	 */
	@RequestMapping("statEterm.sys")
	public ModelAndView statEterm(){
		ModelAndView av=new ModelAndView("page/sys/eterm/eterm");
		av.addObject("list", cacheService.statEterm());
		return av;
	}

}
